3.28 \(\int \frac {\cot (c+d x) (B \tan (c+d x)+C \tan ^2(c+d x))}{a+b \tan (c+d x)} \, dx\)

Optimal. Leaf size=58 \[ \frac {(b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )}+\frac {x (a B+b C)}{a^2+b^2} \]

[Out]

(B*a+C*b)*x/(a^2+b^2)+(B*b-C*a)*ln(a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2)/d

________________________________________________________________________________________

Rubi [A]  time = 0.14, antiderivative size = 58, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, integrand size = 38, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.079, Rules used = {3632, 3531, 3530} \[ \frac {(b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )}+\frac {x (a B+b C)}{a^2+b^2} \]

Antiderivative was successfully verified.

[In]

Int[(Cot[c + d*x]*(B*Tan[c + d*x] + C*Tan[c + d*x]^2))/(a + b*Tan[c + d*x]),x]

[Out]

((a*B + b*C)*x)/(a^2 + b^2) + ((b*B - a*C)*Log[a*Cos[c + d*x] + b*Sin[c + d*x]])/((a^2 + b^2)*d)

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3632

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)
*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[1/b^2, Int[(a + b*Tan[e + f*x])
^(m + 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps

\begin {align*} \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx &=\int \frac {B+C \tan (c+d x)}{a+b \tan (c+d x)} \, dx\\ &=\frac {(a B+b C) x}{a^2+b^2}+\frac {(b B-a C) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)} \, dx}{a^2+b^2}\\ &=\frac {(a B+b C) x}{a^2+b^2}+\frac {(b B-a C) \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right ) d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.13, size = 67, normalized size = 1.16 \[ \frac {(b B-a C) \left (2 \log (a \cot (c+d x)+b)-\log \left (\csc ^2(c+d x)\right )\right )-2 (a B+b C) \tan ^{-1}(\cot (c+d x))}{2 d \left (a^2+b^2\right )} \]

Antiderivative was successfully verified.

[In]

Integrate[(Cot[c + d*x]*(B*Tan[c + d*x] + C*Tan[c + d*x]^2))/(a + b*Tan[c + d*x]),x]

[Out]

(-2*(a*B + b*C)*ArcTan[Cot[c + d*x]] + (b*B - a*C)*(2*Log[b + a*Cot[c + d*x]] - Log[Csc[c + d*x]^2]))/(2*(a^2
+ b^2)*d)

________________________________________________________________________________________

fricas [A]  time = 0.75, size = 76, normalized size = 1.31 \[ \frac {2 \, {\left (B a + C b\right )} d x - {\left (C a - B b\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, {\left (a^{2} + b^{2}\right )} d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(B*tan(d*x+c)+C*tan(d*x+c)^2)/(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(2*(B*a + C*b)*d*x - (C*a - B*b)*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + c)^2 + 1))
)/((a^2 + b^2)*d)

________________________________________________________________________________________

giac [A]  time = 2.15, size = 94, normalized size = 1.62 \[ \frac {\frac {2 \, {\left (B a + C b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} + \frac {{\left (C a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} - \frac {2 \, {\left (C a b - B b^{2}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b + b^{3}}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(B*tan(d*x+c)+C*tan(d*x+c)^2)/(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

1/2*(2*(B*a + C*b)*(d*x + c)/(a^2 + b^2) + (C*a - B*b)*log(tan(d*x + c)^2 + 1)/(a^2 + b^2) - 2*(C*a*b - B*b^2)
*log(abs(b*tan(d*x + c) + a))/(a^2*b + b^3))/d

________________________________________________________________________________________

maple [B]  time = 0.73, size = 153, normalized size = 2.64 \[ \frac {\ln \left (a +b \tan \left (d x +c \right )\right ) B b}{d \left (a^{2}+b^{2}\right )}-\frac {\ln \left (a +b \tan \left (d x +c \right )\right ) a C}{d \left (a^{2}+b^{2}\right )}-\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) B b}{2 d \left (a^{2}+b^{2}\right )}+\frac {\ln \left (1+\tan ^{2}\left (d x +c \right )\right ) a C}{2 d \left (a^{2}+b^{2}\right )}+\frac {B \arctan \left (\tan \left (d x +c \right )\right ) a}{d \left (a^{2}+b^{2}\right )}+\frac {C \arctan \left (\tan \left (d x +c \right )\right ) b}{d \left (a^{2}+b^{2}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)*(B*tan(d*x+c)+C*tan(d*x+c)^2)/(a+b*tan(d*x+c)),x)

[Out]

1/d/(a^2+b^2)*ln(a+b*tan(d*x+c))*B*b-1/d/(a^2+b^2)*ln(a+b*tan(d*x+c))*a*C-1/2/d/(a^2+b^2)*ln(1+tan(d*x+c)^2)*B
*b+1/2/d/(a^2+b^2)*ln(1+tan(d*x+c)^2)*a*C+1/d/(a^2+b^2)*B*arctan(tan(d*x+c))*a+1/d/(a^2+b^2)*C*arctan(tan(d*x+
c))*b

________________________________________________________________________________________

maxima [A]  time = 0.63, size = 88, normalized size = 1.52 \[ \frac {\frac {2 \, {\left (B a + C b\right )} {\left (d x + c\right )}}{a^{2} + b^{2}} - \frac {2 \, {\left (C a - B b\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} + b^{2}} + \frac {{\left (C a - B b\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}}}{2 \, d} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(B*tan(d*x+c)+C*tan(d*x+c)^2)/(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/2*(2*(B*a + C*b)*(d*x + c)/(a^2 + b^2) - 2*(C*a - B*b)*log(b*tan(d*x + c) + a)/(a^2 + b^2) + (C*a - B*b)*log
(tan(d*x + c)^2 + 1)/(a^2 + b^2))/d

________________________________________________________________________________________

mupad [B]  time = 9.12, size = 93, normalized size = 1.60 \[ \frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B\,b-C\,a\right )}{d\,\left (a^2+b^2\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((cot(c + d*x)*(B*tan(c + d*x) + C*tan(c + d*x)^2))/(a + b*tan(c + d*x)),x)

[Out]

(log(a + b*tan(c + d*x))*(B*b - C*a))/(d*(a^2 + b^2)) - (log(tan(c + d*x) + 1i)*(B - C*1i))/(2*d*(a*1i + b)) -
 (log(tan(c + d*x) - 1i)*(B*1i - C))/(2*d*(a + b*1i))

________________________________________________________________________________________

sympy [A]  time = 2.95, size = 541, normalized size = 9.33 \[ \begin {cases} \frac {\tilde {\infty } x \left (B \tan {\relax (c )} + C \tan ^{2}{\relax (c )}\right ) \cot {\relax (c )}}{\tan {\relax (c )}} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {i B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {B d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {i B}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {C d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {i C d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {C}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\- \frac {i B d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {B d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {i B}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {C d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {i C d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {C}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \left (B \tan {\relax (c )} + C \tan ^{2}{\relax (c )}\right ) \cot {\relax (c )}}{a + b \tan {\relax (c )}} & \text {for}\: d = 0 \\\frac {B x + \frac {C \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d}}{a} & \text {for}\: b = 0 \\\frac {2 B a d x}{2 a^{2} d + 2 b^{2} d} + \frac {2 B b \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} d + 2 b^{2} d} - \frac {B b \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} - \frac {2 C a \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {C a \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} d + 2 b^{2} d} + \frac {2 C b d x}{2 a^{2} d + 2 b^{2} d} & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(B*tan(d*x+c)+C*tan(d*x+c)**2)/(a+b*tan(d*x+c)),x)

[Out]

Piecewise((zoo*x*(B*tan(c) + C*tan(c)**2)*cot(c)/tan(c), Eq(a, 0) & Eq(b, 0) & Eq(d, 0)), (I*B*d*x*tan(c + d*x
)/(2*b*d*tan(c + d*x) - 2*I*b*d) + B*d*x/(2*b*d*tan(c + d*x) - 2*I*b*d) + I*B/(2*b*d*tan(c + d*x) - 2*I*b*d) +
 C*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) - 2*I*b*d) - I*C*d*x/(2*b*d*tan(c + d*x) - 2*I*b*d) - C/(2*b*d*tan(c +
 d*x) - 2*I*b*d), Eq(a, -I*b)), (-I*B*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + B*d*x/(2*b*d*tan(c + d
*x) + 2*I*b*d) - I*B/(2*b*d*tan(c + d*x) + 2*I*b*d) + C*d*x*tan(c + d*x)/(2*b*d*tan(c + d*x) + 2*I*b*d) + I*C*
d*x/(2*b*d*tan(c + d*x) + 2*I*b*d) - C/(2*b*d*tan(c + d*x) + 2*I*b*d), Eq(a, I*b)), (x*(B*tan(c) + C*tan(c)**2
)*cot(c)/(a + b*tan(c)), Eq(d, 0)), ((B*x + C*log(tan(c + d*x)**2 + 1)/(2*d))/a, Eq(b, 0)), (2*B*a*d*x/(2*a**2
*d + 2*b**2*d) + 2*B*b*log(a/b + tan(c + d*x))/(2*a**2*d + 2*b**2*d) - B*b*log(tan(c + d*x)**2 + 1)/(2*a**2*d
+ 2*b**2*d) - 2*C*a*log(a/b + tan(c + d*x))/(2*a**2*d + 2*b**2*d) + C*a*log(tan(c + d*x)**2 + 1)/(2*a**2*d + 2
*b**2*d) + 2*C*b*d*x/(2*a**2*d + 2*b**2*d), True))

________________________________________________________________________________________